import Vue from 'vue';
import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';

import App from './App.vue';
import router from './router';

Vue.use(ElementUI);
//权限指令
Vue.directive('has', {
  bind: function(el, binding) {
    if (!Vue.prototype.$_has(binding.value)) {
      el.parentNode.removeChild(el);
    }
  }
});
//路由拦截,判断token是否存在
/*router.beforeEach(function (to, from, next) {
  window.scrollTo(0, 0);//scroll置顶
  if (IsToken.isExistToken()) {
    IsToken.getIsToken((res) => {
      if (res.retCode == 1) {
        next();
      } else {
        cookie.removeCookie("merchant_token");//删除过期登录信息
        router.push({path: '/login'});
      }
    })
  } else {
    if (to.path == '/login' || to.path=='/qrcode' || to.path=='/qrcodecard') {
      next();
    } else {
      router.push({path: '/login'});
    }
  }
});*/
new Vue({
  el: '#app',
  router,
  render: h => h(App)
});

